import { ref } from 'vue'
import NeoVis, { NeovisConfig, } from 'neovis.js'
import { apiList } from '@/api/apiList'

// const query = ref('MATCH p=()-[r:SAYS]->() RETURN p LIMIT 25')
const query = ref('match(n) return n limit 100')

console.log('NeoVis.objectToTitleHtml', NeoVis.objectToTitleHtml)



const neoConfig: NeovisConfig = {
    containerId: 'my-neo-vis',
    dataFunction: async () => {
        const res = await apiList.neo4jApi.query({
            statements: [
                {
                    // statement: 'match (n) return n limit 100',
                    "statement": "MATCH (n) RETURN n LIMIT 5" // 替换成你的查询语句
                },
            ],
        })
        
        return res.data
    },
    nonFlat: false,
    labels: {
        [NeoVis.NEOVIS_DEFAULT_CONFIG]: {
            caption: 'name',
            label: 'name',
            // title_properties: 'name',
        },
    },
    initialCypher: 'MATCH (p)-[r]->(n) RETURN p LIMIT 25',
}

export default {
    query,
    neoConfig,
}
